<template>
	<view class="mainpadding2">
		<view class="ffffff mainpadding_top radius">
			<view class="titletext bold hei_text">选择充值金额</view>
			<view class="flexbetween flex_wrap">
				<view class="lable margin_top" :class="cztype==1?'itemgl':''" @click="checkitem(1,10)">10元</view>
				<view class="lable margin_top" :class="cztype==2?'itemgl':''" @click="checkitem(2,50)">50元</view>
				<view class="lable margin_top" :class="cztype==3?'itemgl':''" @click="checkitem(3,100)">100元</view>
				<view class="lable margin_top" :class="cztype==4?'itemgl':''" @click="checkitem(4,300)">300元</view>
				<view class="lable margin_top" :class="cztype==5?'itemgl':''" @click="checkitem(5,600)">600元</view>
				<view class="lable margin_top" :class="cztype==6?'itemgl':''" @click="checkitem(6,1000)">1000元</view>
			</view>
		</view>
		<view class="mainpadding_top ffffff radius">
			<input type="number" class="lan_text titletext bold" placeholder="自定义充值金额" v-model="pay_price">
		</view>
		<view class="mainpadding_top ffffff radius flexbetween">
			<view class="flexleft">
				<image src="@/static/image/system/wxicon.png" class="wximg margin_right" mode=""></image>
				<view class="titletext hei_text bold">微信</view>
			</view>
			<view class="checkaudio"></view>
		</view>
		<view class="posibottom mainpadding">
			<!-- <view class="flexcenter xiaohui" @click="jumpurl('/pages/mine/tixianjl?type=2')">充值记录</view> -->
			<view class="submitbtn margin_top" @click="submit">立即充值</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				pay_price:"",
				cztype:"",
			}
		},
		methods: {
			checkitem(i,num){
				this.cztype = i;
				this.pay_price = num;
			},
			submit(){
				if (this.pay_price == '') {
					httpRequest.toast("请输入或选择充值金额!")
					return;
				}
				httpRequest.request('/api/rechargeorder/rechargeMoney', 'POST', {
					pay_price:this.pay_price
				}, false, false, true).then(res => {
					httpRequest.toast(res.msg);
					if(res.code==1){
						setTimeout(()=>{
							uni.navigateBack(1)
						},1000)
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			jumpurl(url) {
				uni.navigateTo({
					url
				})
			},
		}
	}
</script>

<style lang="scss">
	.wximg{
		width: 32rpx;
		height: 32rpx;
		min-width: 32rpx;
	}
	.lable{
		width: 180rpx;
		padding: 20rpx 0 ;
	}
</style>
